#ifndef SEARCHFORM_H
#define SEARCHFORM_H

#include <QWidget>
#include <data/UserInfo.pb.h>

namespace Ui {
    class SearchForm;
}

class SearchForm : public QWidget {
    Q_OBJECT

    using UserInfo     = ::proto::data::UserInfo;
    using ChatRoomInfo = ::proto::data::ChatRoomInfo;

public:
    explicit SearchForm(QWidget* parent = nullptr);
    ~SearchForm();

protected:
    void showlist();
    void addWidget(std::shared_ptr<UserInfo> info);

private slots:
    void on_lineEdit_textChanged(const QString& arg1);
    void onSearchAuthor(std::vector<std::shared_ptr<UserInfo>> users);
    void onSearchGroup(std::vector<std::shared_ptr<ChatRoomInfo>> rooms);


private:
    Ui::SearchForm* ui;
    bool            isSearchAuthor = true;
    QTimer* timer = nullptr;
};

#endif  // SEARCHFORM_H
